﻿DROP function get_default_currency;
CREATE OR REPLACE FUNCTION get_default_currency () RETURNS integer AS $$
DECLARE
    default_curr integer ;
BEGIN
	Select 
		id into default_curr from kderp_currency 
	where 
		code=(Select code from res_currency where id =(Select currency_id from res_company limit 1));
    RETURN default_curr;
END;
$$ LANGUAGE plpgsql;